package com.suxin.netty.remoting;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author Tang
 * @classname NettyClientHandler
 * @description [  ]
 * @date 2022/12/16 00:09
 */
public class NettyClientHandler extends SimpleChannelInboundHandler<RemotingCommand> {

    private final AbstractNettyRemoting nettyRemoting;

    public NettyClientHandler(AbstractNettyRemoting nettyRemoting) {
        this.nettyRemoting = nettyRemoting;
    }

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, RemotingCommand msg) throws Exception {
        this.nettyRemoting.processMessageReceived(ctx,msg);
    }
}
